import '../justfiles/go.just'

# Build ldflags string
_LDFLAGSSTRING := "'" + trim(
    "-X main.GitCommit=" + GITCOMMIT + " " + \
    "-X main.GitDate=" + GITDATE + " " + \
    "-X main.Version=" + VERSION + " " + \
    "") + "'"

BINARY := "./bin/op-conductor"

# Build op-conductor binary
op-conductor: (go_build BINARY "./cmd" "-ldflags" _LDFLAGSSTRING)

# Clean build artifacts
clean:
    rm -f {{BINARY}}

# Run tests
test: (go_test "./...")

MOCKERY_VERSION := "v3.2.4"
# Generate mocks
generate-mocks:
  @if ! mockery; then \
    echo "mock generation failed, please ensure mockery version {{MOCKERY_VERSION}} is installed"; \
    echo "go install github.com/vektra/mockery/v3@{{MOCKERY_VERSION}}"; \
  fi
